package com.springbootx.mybatis.service.impl;

import com.springbootx.mybatis.config.DataSourceType;
import com.springbootx.mybatis.config.transactional.MoreTransaction;
import com.springbootx.mybatis.mapper.MasterUsersMapper;
import com.springbootx.mybatis.mapper.SalveUsersMapper;
import com.springbootx.mybatis.pojo.Users;
import com.springbootx.mybatis.service.UserSlaveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p></p>
 *
 * @author Tony.niu (hystrix0779@yeah.net)
 **/
@Service
public class UserSlaveServiceImpl implements UserSlaveService {

    @Resource
    SalveUsersMapper salveUsersMapper;
    @Resource
    MasterUsersMapper masterUsersMapper;

    @Override
    @MoreTransaction
    public void insert() {
        Users salveUsers=new Users();
        salveUsers.setId(0);
        salveUsers.setUserName("salve测试数据");
        salveUsers.setPassWord("salve测试数据");
        salveUsers.setPhone("salve测试数据");
        salveUsers.setEmail("salve测试数据");
        salveUsersMapper.saveData(salveUsers);
        Users masterUsers=new Users();
        masterUsers.setId(0);
        masterUsers.setUserName("master1测试数据");
        masterUsers.setPassWord("master1测试数据");
        masterUsers.setPhone("master1测试数据");
        masterUsers.setEmail("master1测试数据");
        masterUsersMapper.insert(masterUsers);
        Users salveUsers1=new Users();
        salveUsers1.setId(0);
        salveUsers1.setUserName("salve1测试数据");
        salveUsers1.setPassWord("salve1测试数据");
        salveUsers1.setPhone("salve1测试数据");
        salveUsers1.setEmail("salve1测试数据");
        salveUsersMapper.saveData(salveUsers1);
//        System.out.println(1/0);
    }
}
